﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VoiceTestPlatform
{
    public class ParameterManager
    {
        static ParameterManager()
        {
            distanceText = Properties.Settings.Default.DistanceText;
            angelText = Properties.Settings.Default.AngelText;
            noiseText = Properties.Settings.Default.NoiseText;
            loopTimes = Properties.Settings.Default.LoopTimes;

            playDelay = Properties.Settings.Default.PlayDelay;
            voiceDelay = Properties.Settings.Default.VoiceDelay;

            RedistanceText = Properties.Settings.Default.ReDistanceText;
            ReangelText = Properties.Settings.Default.ReAngelText;
            RenoiseText = Properties.Settings.Default.ReNoiseText;

            ArdistanceText = Properties.Settings.Default.ArDistanceText;
            ArangelText = Properties.Settings.Default.ArAngelText;
            ArnoiseText = Properties.Settings.Default.ArNoiseText;



            recordPath = Properties.Settings.Default.RecordPath;
            if (string.IsNullOrEmpty(recordPath))
            {
               recordPath = AppDomain.CurrentDomain.BaseDirectory;
            }

            artificialPath = Properties.Settings.Default.ArtificialPath;
            if (string.IsNullOrEmpty(artificialPath))
            {
                artificialPath = AppDomain.CurrentDomain.BaseDirectory;
            }


        }
        #region 普通 参数属性
        private static string distanceText;

        public static string DistanceText
        {
            get { return distanceText; }
            set
            {
                distanceText = value;
                Properties.Settings.Default.DistanceText = value;
                Properties.Settings.Default.Save();
            }
        }
        private static string angelText;

        public static string AngelText
        {
            get { return angelText; }
            set
            {
                angelText = value;
                Properties.Settings.Default.AngelText = value;
                Properties.Settings.Default.Save();
            }
        }

        private static string noiseText;

        public static string NoiseText
        {
            get { return noiseText; }
            set
            {
                noiseText = value;
                Properties.Settings.Default.NoiseText = value;
                Properties.Settings.Default.Save();
            }
        }



        #endregion

        #region 误操作 参数属性
        private static string RedistanceText;

        public static string ReDistanceText
        {
            get { return RedistanceText; }
            set
            {
                RedistanceText = value;
                Properties.Settings.Default.ReDistanceText = value;
                Properties.Settings.Default.Save();
            }
        }
        private static string ReangelText;

        public static string ReAngelText
        {
            get { return ReangelText; }
            set
            {
                ReangelText = value;
                Properties.Settings.Default.ReAngelText = value;
                Properties.Settings.Default.Save();
            }
        }

        private static string RenoiseText;

        public static string ReNoiseText
        {
            get { return RenoiseText; }
            set
            {
                RenoiseText = value;
                Properties.Settings.Default.ReNoiseText = value;
                Properties.Settings.Default.Save();
            }
        }
        #endregion

        #region 人工 参数属性
        private static string ArdistanceText;

        public static string ArDistanceText
        {
            get { return ArdistanceText; }
            set
            {
                ArdistanceText = value;
                Properties.Settings.Default.ArDistanceText = value;
                Properties.Settings.Default.Save();
            }
        }
        private static string ArangelText;

        public static string ArAngelText
        {
            get { return ArangelText; }
            set
            {
                ArangelText = value;
                Properties.Settings.Default.ArAngelText = value;
                Properties.Settings.Default.Save();
            }
        }

        private static string ArnoiseText;

        public static string ArNoiseText
        {
            get { return ArnoiseText; }
            set
            {
                ArnoiseText = value;
                Properties.Settings.Default.ArNoiseText = value;
                Properties.Settings.Default.Save();
            }
        }



        #endregion

        private static string recordPath;

        public static string RecordPath
        {
            get { return recordPath; }
            set
            {
                recordPath = value;
                Properties.Settings.Default.RecordPath = value;
                Properties.Settings.Default.Save();
            }
        }

        private static string artificialPath;

        public static string ArtificialPath
        {
            get { return artificialPath; }
            set
            {
                artificialPath = value;
                Properties.Settings.Default.ArtificialPath = value;
                Properties.Settings.Default.Save();
            }
        }

        public static string RunDir { get; set; }


        private static int loopTimes;
        /// <summary>
        /// 循环播放次数
        /// </summary>
        public static int LoopTimes
        {
            get { return loopTimes; }
            set 
            {
                loopTimes = value;
                Properties.Settings.Default.LoopTimes = value;
                Properties.Settings.Default.Save();
            }
        }

        private static int playDelay;
        /// <summary>
        /// 播放语音后等识别的延时
        /// </summary>
        public static int PlayDelay
        {
            get { return playDelay; }
            set
            {
                playDelay = value;
                Properties.Settings.Default.PlayDelay = value;
                Properties.Settings.Default.Save();
            }
        }



        private static int voiceDelay;
        /// <summary>
        /// 语音识别成功后延时
        /// </summary>
        public static int VoiceDelay
        {
            get { return voiceDelay; }
            set
            {
                voiceDelay = value;
                Properties.Settings.Default.VoiceDelay = value;
                Properties.Settings.Default.Save();
            }
        }

    }
}
